-
Notifications
You must be signed in to change notification settings - Fork 16
Fix field reflection across lower z #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix field reflection across lower z #364
Conversation
germasch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, staggered grids suck...
For some historical context, PSC used to always use three ghost points on either side, which I think was meant such that it covered [-2, -1, 0, ..., m-1, m, m+1] and [-1.5, -.5, .5, .., m-.5, m+.5, m+1.5] depending on staggering (so it would actually 2 ghost on the left and 3 on the right, or 2 left, 2 right, respectively).
That doesn't mean, though, that these were actually necessary/used in practice. Clearly, first order particles don't need as many ghost points, and another aside is that the ghost points kinda have double duty, being used for interpolation / current deposition, but also do advance the E&M fields, but for the latter I think one only needs to go [0.. m], IIRC.
I don't know if you thought through in particular the case of 2nd order particles (which aren't really sure to be used again anytime soon/ever). But I think it'd be preferable to keep the #ifdef DEBUG poisoning with NaNs, because that's a straightforward way to make sure one isn't using ghostpoints that haven't been set.
This reverts commit f5765b8.
Adds a test to
test_reflective_bcs_integration.cxxthat's the same as the existing one, but along z instead of y. It fails, and the bug is tracked to the current reflection ofpsc_bnd_fields_impl.hxx, which had a double subtraction.This PR also makes field reflection consistently only first-order, i.e., correct to 1 ghost cell, since it's impossible to be consistently second-order with only 2 ghost cells per boundary due to the extra cell that node-aligned quantities require.
That change, plus a removal of some debug stuff, can easily be reverted.